
import javax.swing.*;
import java.util.ArrayList;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;

public class Scores 
{

	ArrayList tempArrayList = new ArrayList();	// holds the scores and names until they can be split
	ArrayList scores = new ArrayList();
	ArrayList names = new ArrayList();
	
	public Scores()
	{
		
	}
	
	/**
	 * displays the scores from previous games
	 */
	public void displayScores()
	{
		
	}
	
	/**
	 * adds score that player just recieved into
	 * the list of previous scores.
	 */
	public void addNewScore()
	{
		
	}
	
	/**
	 * writes the scores and names into a file
	 * that will be its storage
	 * @return
	 */
	private boolean writeFile()
	{
		boolean error = false;
		
//		BufferedWriter writer = new BufferedWriter();
		
		// do i need a try catch statement here?
		
		return error;
	}
	
	/**
	 * reads the scores and names from a file
	 * that holds them while the game is not
	 * being played.
	 * @return
	 */
	// WHERE DOES THE FILENAME COME FROM?
	private boolean readFile(String filename)
	{
		boolean error = false;
		String temp;
		
		try
		{
			FileReader infile = new FileReader(filename);
			BufferedReader buff = new BufferedReader(infile);
			
			temp = buff.readLine();
			while(temp != null)
			{
				tempArrayList.add(temp);
				temp = buff.readLine();
			}
		}
		catch(FileNotFoundException e)
		{
			error = true;
		}
		catch(IOException e)
		{
			error = true;
		}
		
		return error;
	}
	
	private boolean writeFile(String fileName)
	{
		boolean error = false;
		
		return error;
	}
	
	
	/**
	 * 
	 */
	private boolean updateScores()
	{
		boolean error = false;
		
		
		
		return error;
	}
	
}
